package com.allen.workflow.delegate;

import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.camunda.bpm.engine.RuntimeService;
import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.camunda.bpm.engine.runtime.ProcessInstanceQuery;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @program: spring-boot-demo
 * @className ActionJavaDelegate
 * @description: 动作执行代理类
 * @author: zp
 * @create: 2024-08-16 14:01
 * @Version 1.0
 **/
@Component
@AllArgsConstructor
@Slf4j
public class ActionJavaDelegate extends WorkFlowDelegation{

    private RuntimeService runtimeService;
    @Override
    protected void process(BusinessExecution businessExecution) {
        log.info("执行动作：{}", businessExecution.getEventName());
        String processInstanceId = businessExecution.getProcessInstanceId();
        ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).active().singleResult();
    }
}
